

#undef TABLE_START
#undef TABLE_END
#undef _TABLE_FIELD
#undef TABLE_FIELD_INT
#undef TABLE_FIELD_LNG
#undef TABLE_FIELD_STR
#undef TABLE_FIELD_DBL
#undef TABLE_FIELD_BIN



#define _TABLE_CLASS_START(t)				class CEX Table_ ## t:public Table {
#define _TABLE_CLASS_CONS(t)				private: Table_ ## t() { _staticDef = NULL; }
#define _TABLE_CLASS_CONS2(t)				private: Table_ ## t(Table_ ## t* tableDef) : Table(tableDef) {}
#define _TABLE_CLASS_GETNAME(t)				public: virtual const char* __getName(){return "Table_" #t;}
#define _TABLE_CLASS_GETNAME2(t)			public: String getName() { return #t; }
#define _TABLE_CLASS_STAT_VAR(t)			private: static Table_ ## t *_staticDef;
#define _TABLE_CLASS_GETDEF(t)				public: static Table_ ## t* getStaticDef() { return _staticDef ? _staticDef : (_staticDef = new Table_ ## t()); }
#define _TABLE_CLASS_INSERT(t)				public: static Table_ ## t* insert() { return new Table_ ## t(_staticDef); }
#define _TABLE_CLASS_END(t)					};

#define _TABLE_FIELD(t,type,name)			public: TableField<type> name;




#define TABLE_FIELD_INT(t,field)			_TABLE_FIELD(t,int,field)
#define TABLE_FIELD_LNG(t,field)			_TABLE_FIELD(t,long long,field)
#define TABLE_FIELD_DBL(t,field)			_TABLE_FIELD(t,double,field)
#define TABLE_FIELD_STR(t,field,size)		_TABLE_FIELD(t,String,field)


#define TABLE_START(t)						_TABLE_CLASS_START(t) _TABLE_CLASS_CONS(t) _TABLE_CLASS_CONS2(t) _TABLE_CLASS_GETNAME(t) _TABLE_CLASS_GETNAME2(t) \
											_TABLE_CLASS_STAT_VAR(t) _TABLE_CLASS_GETDEF(t) _TABLE_CLASS_INSERT(t) \
											TABLE_FIELD_LNG(t,id)
#define TABLE_END(t)						_TABLE_CLASS_END(t)






